#include <stdio.h>
#include <math.h>
#include "print_html.h"

#define PI 3.14

int main(void)
{
    int i, j;
    int degreeInterval, minuteInterval;
    int odd;
    double degreeWithMinutes;
    double rad;

    degreeInterval = 10;
    minuteInterval = 6;

    printHTTPResponseHeader();
    printHTMLHead();

    printf("<table>\n");
    odd = 1;
    for (i = 0; i <= 360; i += degreeInterval)
    {        
        if (odd && i > 0)
        {
            printf("<tr class=\"odd\">\n");
        }
        else
        {
            printf("<tr>\n");
        }
        odd = 1 - odd;
        if (i == 0)
        {
            printf("<td></td>\n");
        }
        else
        {
            printf("<td class=\"name\"><strong>%d</strong></td>", i);
        }
        for (j = 0; j <= 60; j += minuteInterval)
        {
            degreeWithMinutes = i + j / 60.0;
            rad = degreeWithMinutes * PI / 180.0;
            if(i == 0)
            {
                printf("<td class=\"name\"><strong>%d\'</strong></td>", j);
            }
            else
            {
                printf("<td>%f</td>", sin(rad));
            }
        }
        printf( "\n</tr>\n" );
    }
    printf("</table>\n");

    printHTMLEnd();
    
    return 0;
}